// utils/signUtil.js
import HmacSHA256 from 'crypto-js/hmac-sha256';
import encHex from 'crypto-js/enc-hex';

const SECRET_KEY = 'v1q9Zb_!*@g5N3m0'; // 和后端保持一致

export function generateSignedParams(path) {
  const timestamp = Date.now().toString();
  const nonce = Math.random().toString(36).substring(2, 10);
  const raw = `${path}:${timestamp}:${nonce}`;
  const sign = HmacSHA256(raw, SECRET_KEY).toString(encHex);

  return { timestamp, nonce, sign };
}
